package com.maybach.core.dubbo.consumer.adapter;

import com.audi.dubbo.api.common.Result;
import com.audi.dubbo.api.item.intf.ItemService;
import com.audi.dubbo.api.item.request.ItemParam;
import com.audi.dubbo.api.item.request.ItemPublishRequest;
import com.maybach.core.dubbo.consumer.annotation.Monitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by wenhua on 16/1/28.
 */
@Component
@Monitor(serviceName = "itemService",desc = "商品服务")
public class ItemServiceDubboAdapter {
    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private Long categoryId;

    @Autowired
    ItemService itemService;

    /**
     * 导入
     * @param itemReqList
     * @return
     */

    public Result<Long> publishItem(List<ItemPublishRequest> itemReqList){
        ItemParam req = new ItemParam(categoryId, itemReqList);
        Result<Long> dubboRes = itemService.publishItem(req);
        return dubboRes;
    }
}
